﻿using System.Collections.Generic;

namespace Murry.DataStore
{
    /// <summary>
    /// Interface for Read-only DataStores.
    /// </summary>
    public interface IReadOnlyDataStore
    {
        /// <summary>
        /// Is object type supported by this DataStore.
        /// </summary>
        /// <typeparam name="TInterface">Interface type</typeparam>
        /// <returns>True if supported</returns>
        bool IsSupported<TInterface>();

        /// <summary>
        /// Find all objects of a given type.
        /// </summary>
        /// <typeparam name="TInterface">Interface type</typeparam>
        /// <returns>Objects</returns>
        IEnumerable<TInterface> FindAll<TInterface>();

        /// <summary>
        /// Get a filtered list of object.
        /// </summary>
        /// <typeparam name="TInterface">Interface type</typeparam>
        /// <param name="filter">Filter</param>
        /// <returns>Objects</returns>
        IEnumerable<TInterface> FindByFilter<TInterface>(object filter);

        /// <summary>
        /// Find object by ID.
        /// </summary>
        /// <typeparam name="TInterface">Interface type</typeparam>
        /// <param name="id">Object ID</param>
        /// <returns>Object</returns>
        TInterface FindById<TInterface>(string id);
    }
}
